package Others;

import javax.swing.JLabel;

import GameSet.SnakeFrame;
import Snake.Snake;

public class StatusRunnable implements Runnable {
	Snake snake;
	JLabel satusLabel;
	JLabel scoreLabel;
	public StatusRunnable(Snake snake, JLabel satusLabel, JLabel scoreLabel) {
		this.snake = snake;
		this.satusLabel = satusLabel;
		this.scoreLabel = scoreLabel;
	}
	public void run() {
		String sta = "";
		String spe = "";
		while (true) {
			switch (snake.getStatus()) {
			case Snake.RUNNING:
				sta = "Running";
				break;
			case Snake.PAUSED:
				sta = "Pause";
				break;
			case Snake.GAMEOVER:
				sta = "GameOver";
				break;
			default:
				break;
			}
			SnakeFrame.statusLabel.setText(sta);
			SnakeFrame.scoreLabel.setText("" + Snake.getScore());
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
			
		}
	}

}
